import React, {useState} from 'react'
import Taro from '@tarojs/taro'
import { View, Text, Image,ScrollView} from '@tarojs/components'
function Discount({discountList}){
  // 前往折扣区
  function goToDiscountpage(){
    Taro.navigateTo({
      url: '/pages/index/discountpage/index'
    })
  }
  return (
    <View className='discount'>
      <View className='discount_top' onClick={() => {goToDiscountpage()}}>
        <Text>疯狂折扣</Text>
        <Text>值得买</Text>
        <Text>查看更多</Text>
      </View>
      <View className='discount_con'>
        <ScrollView
          enableFlex
          scrollX
          className='discount_scrollView'
        >
          {
            discountList.map((item,index) => {
             return (
               <View className='discount_items'>
                 <Image className='discount_items_img' src={item.discountUrl} />
                 <Text>{item.newPrice}</Text>
                 <Text>{item.ollPrice}</Text>
               </View>
             )
            })
          }
        </ScrollView>
      </View>
    </View>
  )
}

export default Discount
